#include<bits/stdc++.h>
using namespace std;
#define int long long

int a[200005];

signed main() {
	int n;
	cin >> n;
	int postSum = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		postSum += a[i];
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		postSum -= a[i];
		ans += a[i] * postSum;
	}
	cout << ans;
	return 0;
}
